#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

//交换相邻数组元素数据的函数。
void exc(int arr[],int n)
{
	int x = arr[n];
	arr[n] = arr[n + 1];
	arr[n + 1] = x;
}

int main()
{
	int arr[] = {1,4,5,1,3,4,5,7,9,1};
	int sz = sizeof(arr) / sizeof(arr[0]);
	int count = 0;
	do
	{
		count = 0;
		int n = 0;
		for (n = 0;n < sz;n++)
		{
			if (arr[n] >= arr[n + 1])
				continue;
			else
			{
				exc(arr, n);
				count++;
			}
		}
	} 
	while (count != 0);
	int a = 0;
	for (a = 0;a < sz;a++)
		printf("%d ", arr[a]);
	return 0;
}